package org.edu.service.impl;

import java.sql.SQLException;

import org.edu.bean.TmPersoninfo;
import org.edu.common.BaseDao;
import org.edu.service.TmPersoninfoService;
import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.springframework.orm.hibernate3.HibernateCallback;
import org.springframework.stereotype.Service;
/**
 * 
 * @author lzh
 *
 * 2012-4-18
 */
@Service
public class TmPersoninfoServiceImpl extends BaseDao<TmPersoninfo> implements
		TmPersoninfoService {

	public TmPersoninfo findByCardNo(final String cardno) {
		return (TmPersoninfo)hibernateTemplate.execute(new HibernateCallback() {
			public Object doInHibernate(Session ses) throws HibernateException,
					SQLException {
				return ses.createQuery("FROM TmPersoninfo o WHERE o.cardno=?")
				.setParameter(0,cardno)
				.uniqueResult();
			}
		});
	}

}
